package updatepackage;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import javabean.Employee;

public class Updateemp extends Update{
	public void updateDB(Employee emp){
        Connection conn = null;
        PreparedStatement pstmt = null;
        
        try {
            conn = getConnection();
            
            pstmt = conn.prepareStatement("update EMPLOYEE set empPW=?,empGRADE=?,empPART=?,empROLE=?,empNAME=?,empADDR=?,empCALL=?,empMAIL=?,empPAY=? " + "where empID=?");
            pstmt.setString(1, emp.getEmpPW());
            pstmt.setString(2, emp.getEmpGRADE());
            pstmt.setString(3, emp.getEmpPART());
            pstmt.setString(4, emp.getEmpROLE());
            pstmt.setString(5, emp.getEmpNAME());
            pstmt.setString(6, emp.getEmpADDR());
            pstmt.setString(7, emp.getEmpCALL());
            pstmt.setString(8, emp.getEmpMAIL());
            pstmt.setInt(9, emp.getEmpPAY());
            pstmt.setString(10, emp.getEmpID());
            
            pstmt.executeUpdate();
        } catch(SQLException ex) {
            //throw new EmployeeManagerException("updateEmployee", ex);
        } finally {
            if (pstmt != null) try { pstmt.close(); } catch(SQLException ex) {}
            if (conn != null) try { conn.close(); } catch(SQLException ex) {}
        }
    }
}